import functools


def role_access_check(role_level):
    def _role_access_check(func):
        """
        需要角色身份认证
        """

        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            if role_level == 1:  # user == {} or user == None
                print(1)
                return role_level
            return func(*args, **kwargs)

        return wrapper

    return _role_access_check


@role_access_check(role_level=1)
def a():
    print('a')


if __name__ == '__main__':
    a()
